
import java.awt.Graphics;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author 212010509
 */
public class Handle {
    public static final int Radius = 7;
    public Handle(int[] center) {
        m_coord = new int[2];
        m_coord[0] = center[0];
        m_coord[1] = center[1];
        m_radius = Radius;
    }
    int m_radius;
    int[] m_coord;
    boolean contains(int[] point) {
        int xdiff = Math.abs(m_coord[0]-point[0]);
        int ydiff = Math.abs(m_coord[1]-point[1]);
        return (xdiff < m_radius) && (ydiff < m_radius);  
    }
    void draw(Graphics g) {
        g.drawRect(m_coord[0]-m_radius, m_coord[1]-m_radius, m_radius*2, m_radius*2);
    }
    void updateCoord(int[] newCoord) {
        m_coord[0] = newCoord[0];
        m_coord[1] = newCoord[1];
    }
}
